package com.gengzp.rpc.config;

import com.gengzp.rpc.interceptor.RpcRequestIdentificationInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName RpcInterceptorConfig
 * @Description rpc拦截器配置
 * @Author gengzp
 * @Date 2025/8/22 15:49
 */
@Component
public class RpcInterceptorConfig implements WebMvcConfigurer {

    @Autowired
    private RpcRequestIdentificationInterceptor rpcRequestIdentificationInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 注册rpc框架请求标识信息拦截器
        registry.addInterceptor(rpcRequestIdentificationInterceptor)
                .addPathPatterns("/**");    //拦截所有请求
    }

}
